import request from '@/utils/request'

// 查询Mysql数据备份列表
export function listSysBackup(query) {
  return request({
    url: '/backup/sysBackup/list',
    method: 'get',
    params: query
  })
}

// 查询Mysql数据备份详细
export function getSysBackup(id) {
  return request({
    url: '/backup/sysBackup/' + id,
    method: 'get'
  })
}

// 保存Mysql数据备份
export function saveSysBackup(data) {
  return request({
    url: '/backup/sysBackup/save',
    method: 'post',
    data: data
  })
}

// 删除Mysql数据备份
export function delSysBackup(id) {
  return request({
    url: '/backup/sysBackup/' + id,
    method: 'delete'
  })
}

// 导出Mysql数据备份
export function exportSysBackup(query) {
  return request({
    url: '/backup/sysBackup/export',
    method: 'get',
    params: query
  })
}

// 还原备份
export function reduction(data) {
  return request({
    url: '/backup/sysBackup/reduction/' + data.id,
    method: 'get',
    params: data
  })
}

// 导出Mysql数据备份
export function permanentChange(id, permanent) {
  const formData = new FormData()
  formData.append('id', id)
  formData.append('permanent', permanent)
  return request({
    url: '/backup/sysBackup/updatePermanent',
    method: 'post',
    data: formData
  })
}
